home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / sunrpc / xdr.man < prev   
Encoding:
Text File  |  1989-03-31  |  20.8 KB  |  529 lines

  1.  
  2.  
  3.  
  4. XDR                   C Library Procedures                    XDR
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      xdr - library routines for external data representation
  10.  
  11. SSYYNNOOPPSSIISS AANNDD DDEESSCCRRIIPPTTIIOONN
  12.      These routines allow C programmers to describe arbitrary
  13.      data structures in a machine-independent fashion.  Data for
  14.      remote procedure calls are transmitted using these routines.
  15.  
  16.      xxddrr__aarrrraayy((xxddrrss,, aarrrrpp,, ssiizzeepp,, mmaaxxssiizzee,, eellssiizzee,, eellpprroocc))
  17.      XXDDRR **xxddrrss;;
  18.      cchhaarr ****aarrrrpp;;
  19.      uu__iinntt **ssiizzeepp,, mmaaxxssiizzee,, eellssiizzee;;
  20.      xxddrrpprroocc__tt eellpprroocc;;
  21.  
  22.           A filter primitive that translates between variable-
  23.           length arrays and their corresponding external
  24.           representations. The parameter aarrrrpp is the address of
  25.           the pointer to the array, while ssiizzeepp is the address of
  26.           the element count of the array; this element count can-
  27.           not exceed mmaaxxssiizzee.  The parameter eellssiizzee is the ssiizzeeooff
  28.           each of the array's elements, and eellpprroocc is an XDR
  29.           filter that translates between the array elements' C
  30.           form, and their external representation.  This routine
  31.           returns one if it succeeds, zero otherwise.
  32.  
  33.      xxddrr__bbooooll((xxddrrss,, bbpp))
  34.      XXDDRR **xxddrrss;;
  35.      bbooooll__tt **bbpp;;
  36.  
  37.           A filter primitive that translates between booleans (C
  38.           integers) and their external representations. When
  39.           encoding data, this filter produces values of either
  40.           one or zero.  This routine returns one if it succeeds,
  41.           zero otherwise.
  42.  
  43.      xxddrr__bbyytteess((xxddrrss,, sspp,, ssiizzeepp,, mmaaxxssiizzee))
  44.      XXDDRR **xxddrrss;;
  45.      cchhaarr ****sspp;;
  46.      uu__iinntt **ssiizzeepp,, mmaaxxssiizzee;;
  47.  
  48.           A filter primitive that translates between counted byte
  49.           strings and their external representations.  The param-
  50.           eter sspp is the address of the string pointer. The
  51.           length of the string is located at address ssiizzeepp;
  52.           strings cannot be longer than mmaaxxssiizzee.  This routine
  53.           returns one if it succeeds, zero otherwise.
  54.  
  55.      xxddrr__cchhaarr((xxddrrss,, ccpp))
  56.      XXDDRR **xxddrrss;;
  57.      cchhaarr **ccpp;;
  58.  
  59.           A filter primitive that translates between C characters
  60.  
  61.  
  62.  
  63. Sprite v1.0              3 November 1987                        1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. XDR                   C Library Procedures                    XDR
  71.  
  72.  
  73.  
  74.           and their external representations.  This routine
  75.           returns one if it succeeds, zero otherwise.  Note:
  76.           encoded characters are not packed, and occupy 4 bytes
  77.           each. For arrays of characters, it is worthwhile to
  78.           consider xxddrr__bbyytteess, xxddrr__ooppaaqquueeor xxddrr__ssttrriinngg.
  79.  
  80.      vvooiidd
  81.      xxddrr__ddeessttrrooyy((xxddrrss))
  82.      XXDDRR **xxddrrss;;
  83.  
  84.           A macro that invokes the destroy routine associated
  85.           with the XDR stream, xxddrrss.  Destruction usually
  86.           involves freeing private data structures associated
  87.           with the stream.  Using xxddrrss after invoking xxddrr__ddeessttrrooyy
  88.           is undefined.
  89.  
  90.      xxddrr__ddoouubbllee((xxddrrss,, ddpp))
  91.      XXDDRR **xxddrrss;;
  92.      ddoouubbllee **ddpp;;
  93.  
  94.           A filter primitive that translates between C ddoouubbllee
  95.           precision numbers and their external representations.
  96.           This routine returns one if it succeeds, zero other-
  97.           wise.
  98.  
  99.      xxddrr__eennuumm((xxddrrss,, eepp))
  100.      XXDDRR **xxddrrss;;
  101.      eennuumm__tt **eepp;;
  102.  
  103.           A filter primitive that translates between C eennuumms
  104.           (actually integers) and their external representations.
  105.           This routine returns one if it succeeds, zero other-
  106.           wise.
  107.  
  108.      xxddrr__ffllooaatt((xxddrrss,, ffpp))
  109.      XXDDRR **xxddrrss;;
  110.      ffllooaatt **ffpp;;
  111.  
  112.           A filter primitive that translates between C ffllooaatts and
  113.           their external representations.  This routine returns
  114.           one if it succeeds, zero otherwise.
  115.  
  116.      vvooiidd
  117.      xxddrr__ffrreeee((pprroocc,, oobbjjpp))
  118.      xxddrrpprroocc__tt pprroocc;;
  119.      cchhaarr **oobbjjpp;;
  120.  
  121.           Generic freeing routine. The first argument is the XDR
  122.           routine for the object being freed. The second argument
  123.           is a pointer to the object itself. Note: the pointer
  124.           passed to this routine is _n_o_t freed, but what it points
  125.           to _i_s freed (recursively).
  126.  
  127.  
  128.  
  129. Sprite v1.0              3 November 1987                        2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. XDR                   C Library Procedures                    XDR
  137.  
  138.  
  139.  
  140.      uu__iinntt
  141.      xxddrr__ggeettppooss((xxddrrss))
  142.      XXDDRR **xxddrrss;;
  143.  
  144.           A macro that invokes the get-position routine associ-
  145.           ated with the XDR stream, xxddrrss.  The routine returns an
  146.           unsigned integer, which indicates the position of the
  147.           XDR byte stream.  A desirable feature of XDR streams is
  148.           that simple arithmetic works with this number, although
  149.           the XDR stream instances need not guarantee this.
  150.  
  151.      lloonngg **
  152.      xxddrr__iinnlliinnee((xxddrrss,, lleenn))
  153.      XXDDRR **xxddrrss;;
  154.      iinntt lleenn;;
  155.  
  156.           A macro that invokes the in-line routine associated
  157.           with the XDR stream, xxddrrss.  The routine returns a
  158.           pointer to a contiguous piece of the stream's buffer;
  159.           lleenn is the byte length of the desired buffer.  Note
  160.           that pointer is cast to lloonngg **.
  161.  
  162.           Warning: xxddrr__iinnlliinnee may return NULL (0) if it cannot
  163.           allocate a contiguous piece of a buffer.  Therefore the
  164.           behavior may vary among stream instances; it exists for
  165.           the sake of efficiency.
  166.  
  167.      xxddrr__iinntt((xxddrrss,, iipp))
  168.      XXDDRR **xxddrrss;;
  169.      iinntt **iipp;;
  170.  
  171.           A filter primitive that translates between C integers
  172.           and their external representations.  This routine
  173.           returns one if it succeeds, zero otherwise.
  174.  
  175.      xxddrr__lloonngg((xxddrrss,, llpp))
  176.      XXDDRR **xxddrrss;;
  177.      lloonngg **llpp;;
  178.  
  179.           A filter primitive that translates between C lloonngg
  180.           integers and their external representations.  This rou-
  181.           tine returns one if it succeeds, zero otherwise.
  182.  
  183.      vvooiidd
  184.      xxddrrmmeemm__ccrreeaattee((xxddrrss,, aaddddrr,, ssiizzee,, oopp))
  185.      XXDDRR **xxddrrss;;
  186.      cchhaarr **aaddddrr;;
  187.      uu__iinntt ssiizzee;;
  188.      eennuumm xxddrr__oopp oopp;;
  189.  
  190.           This routine initializes the XDR stream object pointed
  191.           to by xxddrrss.  The stream's data is written to, or read
  192.  
  193.  
  194.  
  195. Sprite v1.0              3 November 1987                        3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. XDR                   C Library Procedures                    XDR
  203.  
  204.  
  205.  
  206.           from, a chunk of memory at location aaddddrr whose length
  207.           is no more than ssiizzee bytes long.  The oopp determines the
  208.           direction of the XDR stream (either XXDDRR__EENNCCOODDEE,
  209.           XXDDRR__DDEECCOODDEE, or XXDDRR__FFRREEEE ).
  210.  
  211.      xxddrr__ooppaaqquuee((xxddrrss,, ccpp,, ccnntt))
  212.      XXDDRR **xxddrrss;;
  213.      cchhaarr **ccpp;;
  214.      uu__iinntt ccnntt;;
  215.  
  216.           A filter primitive that translates between fixed size
  217.           opaque data and its external representation.  The
  218.           parameter ccpp is the address of the opaque object, and
  219.           ccnntt is its size in bytes.  This routine returns one if
  220.           it succeeds, zero otherwise.
  221.  
  222.      xxddrr__ppooiinntteerr((xxddrrss,, oobbjjpppp,, oobbjjssiizzee,, xxddrroobbjj))
  223.      XXDDRR **xxddrrss;;
  224.      cchhaarr ****oobbjjpppp;;
  225.      uu__iinntt oobbjjssiizzee;;
  226.      xxddrrpprroocc__tt xxddrroobbjj;;
  227.  
  228.           Like xxddrr__rreeffeerreennccee in that it XDR xxddrr__ppooiinntteerr serial-
  229.           izes NULL pointers, whereas xxddrr__rreeffeerreennccee does not.
  230.           Thus xxddrr__ppooiinntteerr can XDR recursive data structures,
  231.           such as binary trees or linked lists, correctly,
  232.           whereas xxddrr__rreeffeerreennccee will fail.
  233.  
  234.      vvooiidd
  235.      xxddrrrreecc__ccrreeaattee((xxddrrss,, sseennddssiizzee,, rreeccvvssiizzee,, hhaannddllee,, rreeaaddiitt,, wwrriitteeiitt))
  236.      XXDDRR **xxddrrss;;
  237.      uu__iinntt sseennddssiizzee,, rreeccvvssiizzee;;
  238.      cchhaarr **hhaannddllee;;
  239.      iinntt ((**rreeaaddiitt))(()),, ((**wwrriitteeiitt))(());;
  240.  
  241.           This routine initializes the XDR stream object pointed
  242.           to by xxddrrss.  The stream's data is written to a buffer
  243.           of size sseennddssiizzee; a value of zero indicates the system
  244.           should use a suitable default. The stream's data is
  245.           read from a buffer of size rreeccvvssiizzee; it too can be set
  246.           to a suitable default by passing a zero value.  When a
  247.           stream's output buffer is full, wwrriitteeiitt is called.
  248.           Similarly, when a stream's input buffer is empty,
  249.           rreeaaddiitt is called.  The behavior of these two routines
  250.           is similar to the UNIX system calls rreeaadd and wwrriittee,
  251.           except that hhaannddllee is passed to the former routines as
  252.           the first parameter.  Note that the XDR stream's oopp
  253.           field must be set by the caller.
  254.  
  255.           Warning: this XDR stream implements an intermediate
  256.           record stream.  Therefore there are additional bytes in
  257.           the stream to provide record boundary information.
  258.  
  259.  
  260.  
  261. Sprite v1.0              3 November 1987                        4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. XDR                   C Library Procedures                    XDR
  269.  
  270.  
  271.  
  272.      xxddrrrreecc__eennddooffrreeccoorrdd((xxddrrss,, sseennddnnooww))
  273.      XXDDRR **xxddrrss;;
  274.      iinntt sseennddnnooww;;
  275.  
  276.           This routine can be invoked only on streams created by
  277.           xxddrrrreecc__ccrreeaattee.  The data in the output buffer is marked
  278.           as a completed record, and the output buffer is option-
  279.           ally written out if sseennddnnooww is non-zero. This routine
  280.           returns one if it succeeds, zero otherwise.
  281.  
  282.      xxddrrrreecc__eeooff((xxddrrss))
  283.      XXDDRR **xxddrrss;;
  284.      iinntt eemmppttyy;;
  285.  
  286.           This routine can be invoked only on streams created by
  287.           xxddrrrreecc__ccrreeaattee.  After consuming the rest of the current
  288.           record in the stream, this routine returns one if the
  289.           stream has no more input, zero otherwise.
  290.  
  291.      xxddrrrreecc__sskkiipprreeccoorrdd((xxddrrss))
  292.      XXDDRR **xxddrrss;;
  293.  
  294.           This routine can be invoked only on streams created by
  295.           xxddrrrreecc__ccrreeaattee.  It tells the XDR implementation that
  296.           the rest of the current record in the stream's input
  297.           buffer should be discarded.  This routine returns one
  298.           if it succeeds, zero otherwise.
  299.  
  300.      xxddrr__rreeffeerreennccee((xxddrrss,, pppp,, ssiizzee,, pprroocc))
  301.      XXDDRR **xxddrrss;;
  302.      cchhaarr ****pppp;;
  303.      uu__iinntt ssiizzee;;
  304.      xxddrrpprroocc__tt pprroocc;;
  305.  
  306.           A primitive that provides pointer chasing within struc-
  307.           tures.  The parameter pppp is the address of the pointer;
  308.           ssiizzee is the ssiizzeeooff the structure that **pppp points to;
  309.           and pprroocc is an XDR procedure that filters the structure
  310.           between its C form and its external representation.
  311.           This routine returns one if it succeeds, zero other-
  312.           wise.
  313.  
  314.           Warning: this routine does not understand NULL
  315.           pointers. Use xxddrr__ppooiinntteerr instead.
  316.  
  317.      xxddrr__sseettppooss((xxddrrss,, ppooss))
  318.      XXDDRR **xxddrrss;;
  319.      uu__iinntt ppooss;;
  320.  
  321.           A macro that invokes the set position routine associ-
  322.           ated with the XDR stream xxddrrss.  The parameter ppooss is a
  323.           position value obtained from xxddrr__ggeettppooss.  This routine
  324.  
  325.  
  326.  
  327. Sprite v1.0              3 November 1987                        5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. XDR                   C Library Procedures                    XDR
  335.  
  336.  
  337.  
  338.           returns one if the XDR stream could be repositioned,
  339.           and zero otherwise.
  340.  
  341.           Warning: it is difficult to reposition some types of
  342.           XDR streams, so this routine may fail with one type of
  343.           stream and succeed with another.
  344.  
  345.      xxddrr__sshhoorrtt((xxddrrss,, sspp))
  346.      XXDDRR **xxddrrss;;
  347.      sshhoorrtt **sspp;;
  348.  
  349.           A filter primitive that translates between C sshhoorrtt
  350.           integers and their external representations.  This rou-
  351.           tine returns one if it succeeds, zero otherwise.
  352.  
  353.      vvooiidd
  354.      xxddrrssttddiioo__ccrreeaattee((xxddrrss,, ffiillee,, oopp))
  355.      XXDDRR **xxddrrss;;
  356.      FFIILLEE **ffiillee;;
  357.      eennuumm xxddrr__oopp oopp;;
  358.  
  359.           This routine initializes the XDR stream object pointed
  360.           to by xxddrrss.  The XDR stream data is written to, or read
  361.           from, the Standard II//OO stream ffiillee.  The parameter oopp
  362.           determines the direction of the XDR stream (either
  363.           XXDDRR__EENNCCOODDEE , XXDDRR__DDEECCOODDEE , or XXDDRR__FFRREEEE ).
  364.  
  365.           Warning: the destroy routine associated with such XDR
  366.           streams calls fffflluusshh on the ffiillee stream, but never
  367.           ffcclloossee.
  368.  
  369.      xxddrr__ssttrriinngg((xxddrrss,, sspp,, mmaaxxssiizzee))
  370.      XXDDRR **xxddrrss;;
  371.      cchhaarr ****sspp;;
  372.      uu__iinntt mmaaxxssiizzee;;
  373.  
  374.           A filter primitive that translates between C strings
  375.           and their corresponding external representations.
  376.           Strings cannot be longer than mmaaxxssiizzee.  Note that sspp is
  377.           the address of the string's pointer.  This routine
  378.           returns one if it succeeds, zero otherwise.
  379.  
  380.      xxddrr__uu__cchhaarr((xxddrrss,, uuccpp))
  381.      XXDDRR **xxddrrss;;
  382.      uunnssiiggnneedd cchhaarr **uuccpp;;
  383.  
  384.           A filter primitive that translates between uunnssiiggnneedd C
  385.           characters and their external representations.  This
  386.           routine returns one if it succeeds, zero otherwise.
  387.  
  388.      xxddrr__uu__iinntt((xxddrrss,, uupp))
  389.      XXDDRR **xxddrrss;;
  390.  
  391.  
  392.  
  393. Sprite v1.0              3 November 1987                        6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. XDR                   C Library Procedures                    XDR
  401.  
  402.  
  403.  
  404.      uunnssiiggnneedd **uupp;;
  405.  
  406.           A filter primitive that translates between C uunnssiiggnneedd
  407.           integers and their external representations.  This rou-
  408.           tine returns one if it succeeds, zero otherwise.
  409.  
  410.      xxddrr__uu__lloonngg((xxddrrss,, uullpp))
  411.      XXDDRR **xxddrrss;;
  412.      uunnssiiggnneedd lloonngg **uullpp;;
  413.  
  414.           A filter primitive that translates between C uunnssiiggnneedd
  415.           lloonngg integers and their external representations.  This
  416.           routine returns one if it succeeds, zero otherwise.
  417.  
  418.      xxddrr__uu__sshhoorrtt((xxddrrss,, uusspp))
  419.      XXDDRR **xxddrrss;;
  420.      uunnssiiggnneedd sshhoorrtt **uusspp;;
  421.  
  422.           A filter primitive that translates between C uunnssiiggnneedd
  423.           sshhoorrtt integers and their external representations.
  424.           This routine returns one if it succeeds, zero other-
  425.           wise.
  426.  
  427.      xxddrr__uunniioonn((xxddrrss,, ddssccmmpp,, uunnpp,, cchhooiicceess,, ddffaauulltt))
  428.      XXDDRR **xxddrrss;;
  429.      iinntt **ddssccmmpp;;
  430.      cchhaarr **uunnpp;;
  431.      ssttrruucctt xxddrr__ddiissccrriimm **cchhooiicceess;;
  432.      bbooooll__tt ((**ddeeffaauullttaarrmm))(());;  //** mmaayy eeqquuaall NNUULLLL **//
  433.  
  434.           A filter primitive that translates between a discrim-
  435.           inated C uunniioonn and its corresponding external represen-
  436.           tation. It first translates the discriminant of the
  437.           union located at ddssccmmpp.  This discriminant is always an
  438.           eennuumm__tt.  Next the union located at uunnpp is translated.
  439.           The parameter cchhooiicceess is a pointer to an array of
  440.           xxddrr__ddiissccrriimm structures. Each structure contains an
  441.           ordered pair of [[vvaalluuee,, pprroocc]].  If the union's discrim-
  442.           inant is equal to the associated vvaalluuee, then the pprroocc
  443.           is called to translate the union.  The end of the
  444.           xxddrr__ddiissccrriimm structure array is denoted by a routine of
  445.           value NULL . If the discriminant is not found in the
  446.           cchhooiicceess array, then the ddeeffaauullttaarrmm procedure is called
  447.           (if it's not NULL ).  Returns one if it succeeds, zero
  448.           otherwise.
  449.  
  450.      xxddrr__vveeccttoorr((xxddrrss,, aarrrrpp,, ssiizzee,, eellssiizzee,, eellpprroocc))
  451.      XXDDRR **xxddrrss;;
  452.      cchhaarr **aarrrrpp;;
  453.      uu__iinntt ssiizzee,, eellssiizzee;;
  454.      xxddrrpprroocc__tt eellpprroocc;;
  455.  
  456.  
  457.  
  458.  
  459. Sprite v1.0              3 November 1987                        7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. XDR                   C Library Procedures                    XDR
  467.  
  468.  
  469.  
  470.           A filter primitive that translates between fixed-length
  471.           arrays and their corresponding external representa-
  472.           tions.  The parameter aarrrrpp is the address of the
  473.           pointer to the array, while ssiizzee is is the element
  474.           count of the array.  The parameter eellssiizzee is the ssiizzeeooff
  475.           each of the array's elements, and eellpprroocc is an XDR
  476.           filter that translates between the array elements' C
  477.           form, and their external representation.  This routine
  478.           returns one if it succeeds, zero otherwise.
  479.  
  480.      xxddrr__vvooiidd(())
  481.  
  482.           This routine always returns one.  It may be passed to
  483.           RPC routines that require a function parameter, where
  484.           nothing is to be done.
  485.  
  486.      xxddrr__wwrraappssttrriinngg((xxddrrss,, sspp))
  487.      XXDDRR **xxddrrss;;
  488.      cchhaarr ****sspp;;
  489.  
  490.           A primitive that calls xxddrr__ssttrriinngg((xxddrrss,, sspp,,
  491.           MMAAXXUUNN..UUNNSSIIGGNNEEDD ); where MMAAXXUUNN..UUNNSSIIGGNNEEDD is the maximum
  492.           value of an unsigned integer.  xxddrr__wwrraappssttrriinngg is handy
  493.           because the RPC package passes a maximum of two XDR
  494.           routines as parameters, and xxddrr__ssttrriinngg, one of the most
  495.           frequently used primitives, requires three.  Returns
  496.           one if it succeeds, zero otherwise.
  497.  
  498. SSEEEE AALLSSOO
  499.      RRPPCC(3N)
  500.      The followin manuals:
  501.           _e_X_t_e_r_n_a_l _D_a_t_a _R_e_p_r_e_s_e_n_t_a_t_i_o_n _S_t_a_n_d_a_r_d: _P_r_o_t_o_c_o_l _S_p_e_c_i_f_-
  502.           _i_c_a_t_i_o_n
  503.           _e_X_t_e_r_n_a_l _D_a_t_a _R_e_p_r_e_s_e_n_t_a_t_i_o_n: _S_u_n _T_e_c_h_n_i_c_a_l _N_o_t_e_s
  504.           _X_D_R: _E_x_t_e_r_n_a_l _D_a_t_a _R_e_p_r_e_s_e_n_t_a_t_i_o_n _S_t_a_n_d_a_r_d, RFC1014,
  505.           Sun Microsystems, Inc., USC-ISI.
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525. Sprite v1.0              3 November 1987                        8
  526.  
  527.  
  528.  
  529.